package com.compass.doctor.dialog

import android.view.Gravity
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.fragment.app.FragmentActivity
import com.compass.doctor.callback.OnCustomButtonClick
import com.compass.doctor.databinding.DialogAddDiagnoseBinding
import com.compass.framework.base.BaseDialog
import com.compass.framework.base.BaseDialogFragment
import com.compass.framework.ext.onClick
import com.compass.framework.toast.TipsToast

/**
 * Description： 添加诊断Dialog
 * Date:2023/12/15 17:32
 */
class AppendDiagnoseDialog {
    class Builder(activity: FragmentActivity, private var onBottomClick: OnCustomButtonClick?=null) : BaseDialogFragment.Builder<Builder>(activity) {

        private val mBinding: DialogAddDiagnoseBinding =
            DialogAddDiagnoseBinding.inflate(LayoutInflater.from(activity))

        init {
            initView()
        }

        private fun initView() {
            setContentView(mBinding.root)
            setWidth(ViewGroup.LayoutParams.MATCH_PARENT)
            setHeight(ViewGroup.LayoutParams.WRAP_CONTENT)
            setAnimStyle(BaseDialog.AnimStyle.BOTTOM)
            gravity = Gravity.BOTTOM

            mBinding.tvRefusal.onClick {
                var suggest = mBinding.edtReasonForRefusal.text.toString().trim()
                dismiss()
                onBottomClick?.onButtonCallBack(1, suggest)
            }
            mBinding.tvCancel.onClick {
                dismiss()
            }
        }


    }
}